package databases;


import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class Db extends SQLiteOpenHelper {
	public Db(Context context)
	{
		super(context, "List", null, 1);
	}
	
	@Override
	public void onCreate(SQLiteDatabase db)
	{
		db.execSQL("CREATE TABLE Favorecido(_id INTEGER PRIMARY KEY AUTOINCREMENT, nome TEXT NOT NULL);");
		db.execSQL("CREATE TABLE Conta(_id INTEGER PRIMARY KEY AUTOINCREMENT, nome TEXT NOT NULL);");
		db.execSQL("CREATE TABLE Categoria(_id INTEGER PRIMARY KEY AUTOINCREMENT, nome TEXT NOT NULL);");
		db.execSQL("CREATE TABLE Lancamento(_id INTEGER PRIMARY KEY AUTOINCREMENT, id_conta INTEGER NOT NULL, id_favorecido INTEGER NOT NULL, id_categoria INTEGER NOT NULL, data STRING, valor REAL, pago INTEGER, tipo INTEGER);");
	}
	
	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
	{

	}
}
